package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.MallActivityShareSpecs;
import com.sc.nft.entity.MallActivityShareTeam;
import com.sc.nft.entity.dto.AdminMallActivityShareSpecsDetailDTO;
import com.sc.nft.mapper.MallActivityShareSpecsMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 分享购活动规格DAO
 *
 * @author liGen
 * @version 1.0
 * @date 2023/12/11 2:59 下午
 */
@Slf4j
@Repository
public class MallActivityShareSpecsDao extends ServiceImpl<MallActivityShareSpecsMapper, MallActivityShareSpecs> {


    /**
     * 获取分享活动下活动规格
     *
     * @param activityShareId
     * @return
     */
    public List<AdminMallActivityShareSpecsDetailDTO> getAdminShareSpecsDetailDTOListByShareId(Long activityShareId) {
        return baseMapper.getAdminShareSpecsDetailDTOListByShareId(activityShareId);
    }

    /**
     * 获取分享活动下活动规格
     *
     * @param activityShareId
     * @return
     */
    public List<MallActivityShareSpecs> getList(Long activityShareId) {
        LambdaQueryWrapper<MallActivityShareSpecs> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(MallActivityShareSpecs::getActivityShareId, activityShareId);
        return baseMapper.selectList(wrapper);
    }

    /**
     * 获取分享活动下活动规格
     *
     * @param activityShareId
     * @return
     */
    public MallActivityShareSpecs getMallActivityShareSpecs(Long activityShareId, Long activityId, Long activitySpecsId) {
        LambdaQueryWrapper<MallActivityShareSpecs> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(MallActivityShareSpecs::getActivityShareId, activityShareId);
        wrapper.eq(MallActivityShareSpecs::getActivityId, activityId);
        wrapper.eq(MallActivityShareSpecs::getActivitySpecsId, activitySpecsId);
        return getOne(wrapper);
    }

}
